# 使用class关键字来声明一个类, 类的名称必须以大写字母开头

class Dog():

  def __init__(self, name, age):
    self.name = name
    self.age = age
  
  def sit(self):
    print (self.name.title() + " is now sitting.")

  def roll_over(self):
    print (self.name.title() + " rolled over.")

  def getAge(self):
    print (self.name.title() + " is now " + self.age + '.')

# 构建一个实例对象
myDog = Dog('WangWang', '6')

# 使用这个实例对象
myDog.sit()
myDog.roll_over()
myDog.getAge()
# Wangwang is now sitting.
# Wangwang rolled over.
# Wangwang is now 6.